NOTE: This Technical Q&A has been retired. Please see the Technical Q&As page for current documentation.

Technical Q&A DV05
Determining Whether a Device Supports Asynchronous I/O


Q: How can we determine whether a device supports asynchronous I/O?

A: The best way to determine if a SCSI device supports asynchronous I/O is to use Gestalt. Check the gestaltSCSI selector to see if the gestaltAsyncSCSI bit is set, as shown below:

#include <Gestalt.h>Boolean CanDoAsyncSCSI(void)
{
  long response;
  OSErr err;
  err = Gestalt(gestaltSCSI, &response);
  if (err) return false;
  return (response & (1 << gestaltAsyncSCSI) );
}

There is no Gestalt test currently available for non-SCSI devices. You can assume that asynchronous calls to a driver will be handled correctly. If the driver is actually asynchronous, your completion routine is called when the I/O is finished. If the driver is not asynchronous, the driver returns and calls your completion routine when the I/O is finished.

For more information, see the SCSI Manager 4.3 chapter of Inside Macintosh:Devices and "Asynchronous routines on the Macintosh" in issue 13 of Develop.

[Jul 01 1995]


Developer Documentation | Technical Notes | Development Kits | Sample Code